import {createSlice} from "@reduxjs/toolkit";
interface ThemeState {
    currentTheme: string;
}
const initialState: ThemeState = {
    currentTheme: "light",
}
const themeSlice = createSlice({
    name:'theme',
    initialState,
    reducers:{
        toggleTheme:(state)=>{
            state.currentTheme = state.currentTheme === "light" ? "dark" : "light";
        }
    }
});
export const {toggleTheme} = themeSlice.actions;
export const selectCurrentTheme = (state:RootState) => state.theme.currentTheme;
export default themeSlice.reducer;